package parser;
import java.util.*;
import java.io.*; 
import antlr.RecognitionException;
import antlr.Token;

public class LoadClass extends Stmt {
    
    LoadClass(int name, List<Expr> supers, Stmt suite) {
        this.name = name;
        this.supers = new Tuple(supers);
        this.suite = suite;
        if (body.yields)
            throw new RecognitionException("Cannot yield in a class definition");
        // Don't propogate delete as it won't effect the surrounding function (if any)
    }
    
    int name;
    Tuple supers;
    Stmt suite;
    
    void write(ByteStream out) throws RecognitionException {
        out.write(Opcodes.NEW_SCOPE);
        out.writeShort(name);
        suite.write(out);
        out.write(Opcodes.POP_SCOPE);
        out.line(line);
        supers.write(out);
        out.write(Opcodes.MAKE_CLASS);
        out.writeShort(name);
        out.write(Opcodes.STORE_GLOBAL);
        out.writeShort(name);
    }
    
}
